<template>
	<view class="">
		<view class="subhead">
			<view class="subheadText" @click="changeSub(item,index)" v-for="(item,index) in subData">
				<view  :style="item.checked?'background-color: #fff;':''" class="textbox">
					<view>{{item.name}}</view>
				</view>
				
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		props: {
			subData: {
				type: Array,
				Array: []
			}
		},
		data() {
			return {
				// 
				
			}

		},
		methods:{
			changeSub(item,index){
				this.$emit('changeSub',index)
				// this.subData.forEach(item=>{
				// 	item.checked=false
				// })
				// this.subData[index].checked=true
				// console.log("this.subData",this.subData)
			}
		}
	}
</script>

<style lang="scss">
	.subhead {
		display: flex;
		width: 100%;
		height: 80rpx;
		border-radius: 10rpx;
		background-color: #f2f2f2;
		box-sizing: border-box;
		padding: 10rpx;

		.subheadText {
			position: relative;
			background-color: '#ffffff';
			font-weight: '600';

			flex: 1;
			height: 100%;
			color: #505050;
			box-sizing: border-box;
			margin: 0 5rpx;
			display: flex;

			text {
				font-weight: 400;
			}


			.textbox {
				flex: 1;
				height: 100%;
				display: flex;
				justify-content: space-around;
				align-items: center;
				z-index: 2;
				background-color: #f2f2f2;
			}

			
		}
	}
</style>
